I am trying to delve right into groovy coding by “fixing” the SmartWeather Station DTH.
I see the capabilities, but how do those capabilities tie into the rest of the DTH?
The reason I am editing it is because I would like to add dewpoint and UV Index to my InfluxDB reporting.
In Chronograph, it’s just not reporting because I don’t understand how to make it report for uvIndex
I don’t get how “capabilities” are tied to the rest of the DTH.
Also, I am at a loss of how to get things to register as strings. I thought “${obs.uv}” would be a string but it’s registering as a float when it comes for the InfluxDB Logger to put it into the DB. I have to put a space in there, or some other text after the }. This also causes the Infux Logger to put an escape after every word…
My Code: send(name: “pressure”, value: obs.pressure_mb.toString())
Result: postToInfluxDB(): Something went wrong! Response from InfluxDB: Headers: [content-length:153, x-influxdb-error:partial write: field type conflict: input field “value” on measurement “pressure” is type float, already exists as type string dropped=1, request-id:6559c8f4-aa0b-11e8-b480-000000000000, http/1.1 400 bad request:null, x-request-id:6559c8f4-aa0b-11e8-b480-000000000000, x-influxdb-build:OSS, content-type:application/json, date:Mon, 27 Aug 2018 15:10:55 GMT, x-influxdb-version:1.6.1], Body: {“error”:“partial write: field type conflict: input field “value” on measurement “pressure” is type float, already exists as type string dropped=1”}
That is the original that I am working with.
I’d also LOVE to know how it’s getting the URL for WeatherUnderground. Because it’s not in “def polling”
where are you passing this to influxdb, send is doing a normal sendevent.
attribute pressure is defined as string, the defined capabilities do not have pressure defined as an attribute.
A device can have one or more capabilities (these are defined by SmartThings, no custom ones). Each capabilty, e.g. Thermostat Mode can have attributes defined to it, thermostatMode and supportedThermostatModes. You can find these in the capability reference doc. Sometimes custom DTH´s will define attributes themselves to be displayed on tiles. Then you will see the attribute statement. In your case pressure is an attribute. This pressure is being send into the smartthings system with the sendEvent function.
The influxdb app will subscribe to the selected events. I am curious what the log of this app tells you when the preessure event is being processed, it should show some sort of log when the event is detected.
In the weatherstation app, i do not think you need to convert the value to a string, the influx app will do if needed.
Nothing else in the log??? I don’t know the app, is there any option to enable logging?
edit: just looked into the app. It does, in the general setting there is an input configLevelIDE. Default is 3 (info) which should display the event values before it sends them to the database…can you check if 3 is in your settings and if so this should display something in the live logging of the IDE…
12:50:45 PM: error postToInfluxDB(): Something went wrong! Response from InfluxDB: Headers: [content-length:153, x-influxdb-error:partial write: field type conflict: input field “value” on measurement “pressure” is type float, already exists as type string dropped=1, request-id:7c9af2ee-aa32-11e8-a356-000000000000, http/1.1 400 bad request:null, x-request-id:7c9af2ee-aa32-11e8-a356-000000000000, x-influxdb-build:OSS, content-type:application/json, date:Mon, 27 Aug 2018 19:50:45 GMT, x-influxdb-version:1.6.1], Body: {“error”:“partial write: field type conflict: input field “value” on measurement “pressure” is type float, already exists as type string dropped=1”}
Still no good f51955cf-c2bd-433a-93f1-ee3a815d05e1 11:49:50 PM: error postToInfluxDB(): Something went wrong! Response from InfluxDB: Headers: [content-length:153, x-influxdb-error:partial write: field type conflict: input field “value” on measurement “pressure” is type float, already exists as type string dropped=1, request-id:b98bbec9-ab57-11e8-b52c-000000000000, http/1.1 400 bad request:null, x-request-id:b98bbec9-ab57-11e8-b52c-000000000000, x-influxdb-build:OSS, content-type:application/json, date:Wed, 29 Aug 2018 06:49:49 GMT, x-influxdb-version:1.6.1], Body: {“error”:“partial write: field type conflict: input field “value” on measurement “pressure” is type float, already exists as type string dropped=1”}
i do not know influx, but is field pressure already defined as a string type on the DB schema and it will treat all numerics as floats, so it cannot insert this. Any way to redefine the field as a number in influx?