Small fixes
This commit is contained in:
parent
490655fb02
commit
49318f3191
3 changed files with 8 additions and 11 deletions
|
|
@ -34,10 +34,6 @@ Account linking is required for your app to interact with the server.
|
|||
* Then in the upper right hand corner select the Test button to generate the draft version Test App.
|
||||
* Add the google_assistant integration configuration to your configuration.yaml file and restart Home Assistant following the configuration guide below.
|
||||
|
||||
#### Create Self signed Certificate (does not work with Google as they require a proper cert)
|
||||
Run the command:
|
||||
${JAVA_HOME}/bin/keytool -genkey -keyalg RSA -alias tomcat -keystore selfsigned.jks -validity <days> -keysize 2048
|
||||
|
||||
### On Phone
|
||||
* Open the Google Home app and go to Settings.
|
||||
* Click Add..., + Set up or add, + Set up device, and click Have something already setup?. You should have [test] your app name listed under ‘Add new'. Selecting that should lead you to a browser to login your Home Assistant instance, then redirect back to a screen where you can set rooms and nicknames for your devices if you wish.
|
||||
|
|
|
|||
|
|
@ -153,15 +153,16 @@ public class SmartHomeImpl extends SmartHomeApp implements TokenRegistrationList
|
|||
long sensorId = Long.parseLong(device.getId().substring(7)); // Get the number in the id "Sensor-<number>"
|
||||
Sensor sensor = Sensor.getSensor(db, sensorId);
|
||||
DeviceTrait[] traits = DeviceTraitFactory.getTraits(sensor);
|
||||
|
||||
Map<String, Object> deviceState = new HashMap<>();
|
||||
|
||||
logger.fine("Generating response for sensor: " + sensor.getName() + " (Id: " + sensor.getId() + ")");
|
||||
|
||||
for (DeviceTrait trait : traits) {
|
||||
deviceState.putAll(trait.generateQueryResponse(sensor.getDeviceData()));
|
||||
}
|
||||
|
||||
deviceState.put("status", "SUCCESS");
|
||||
deviceStates.put(device.id, deviceState);
|
||||
deviceStates.put(device.getId(), deviceState);
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, "Query request failed for sensor: " + device.getId(), e);
|
||||
Map<String, Object> failedDevice = new HashMap<>();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ package se.hal.plugin.assistant.google.trait;
|
|||
|
||||
import se.hal.intf.HalDeviceData;
|
||||
import se.hal.intf.HalSensorConfig;
|
||||
import se.hal.struct.devicedata.TemperatureSensorData;
|
||||
import se.hal.struct.devicedata.HumiditySensorData;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
|
@ -41,11 +41,11 @@ public class HumiditySettingTrait extends DeviceTrait {
|
|||
public HashMap<String, Object> generateSyncResponse(HalSensorConfig config) {
|
||||
HashMap<String, Object> response = new HashMap<>();
|
||||
//response.put("humiditySetpointRange", new HashMap<String, Object>() {{
|
||||
// put("minPercent", -20);
|
||||
// put("maxPercent", 60);
|
||||
// put("minPercent", 0);
|
||||
// put("maxPercent", 100);
|
||||
//}});
|
||||
//response.put("commandOnlyHumiditySetting", false);
|
||||
response.put("queryOnlyHumiditySetting", false);
|
||||
response.put("queryOnlyHumiditySetting", true);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ public class HumiditySettingTrait extends DeviceTrait {
|
|||
public HashMap<String, Object> generateQueryResponse(HalDeviceData data) {
|
||||
HashMap<String, Object> response = new HashMap<>();
|
||||
|
||||
if (data instanceof TemperatureSensorData) {
|
||||
if (data instanceof HumiditySensorData) {
|
||||
//response.put("humiditySetpointPercent", data.getData());
|
||||
response.put("humidityAmbientPercent", data.getData());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue