Page 1 of 1

GhostXML and PostgreSQL

PostPosted: Fri Mar 08, 2024 2:29 pm
by johnpolasek
Why do GhostXML "devices" not post to the Postgres data base? I use GhostXML to query my local Davis weather station's API, which I query query every 5 minutes with http://<IP of Station>/v1/current_conditions and get back :
    {"data":{"did":"001D0A71869D","ts":1709929205,"conditions":[{"lsid":568740,"data_structure_type":1,"txid":2,"temp": 76.1,"hum":54.5,"dew_point": 58.5,"wet_bulb": 63.0,"heat_index": 76.6,"wind_chill": 76.1,"thw_index": 76.6,"thsw_index":null,"wind_speed_last":0.00,"wind_dir_last":0,"wind_speed_avg_last_1_min":0.75,"wind_dir_scalar_avg_last_1_min":29,"wind_speed_avg_last_2_min":2.81,"wind_dir_scalar_avg_last_2_min":7,"wind_speed_hi_last_2_min":9.00,"wind_dir_at_hi_speed_last_2_min":360,"wind_speed_avg_last_10_min":0.87,"wind_dir_scalar_avg_last_10_min":25,"wind_speed_hi_last_10_min":9.93,"wind_dir_at_hi_speed_last_10_min":4,"rain_size":1,"rain_rate_last":0,"rain_rate_hi":0,"rainfall_last_15_min":0,"rain_rate_hi_last_15_min":0,"rainfall_last_60_min":0,"rainfall_last_24_hr":2,"rain_storm":0,"rain_storm_start_at":null,"solar_rad":null,"uv_index":null,"rx_state":0,"trans_battery_flag":0,"rainfall_daily":2,"rainfall_monthly":2,"rainfall_year":1350,"rain_storm_last":195,"rain_storm_last_start_at":1707578461,"rain_storm_last_end_at":1707757261},{"lsid":568738,"data_structure_type":4,"temp_in": 78.6,"hum_in":54.0,"dew_point_in": 60.6,"heat_index_in": 79.0},{"lsid":568737,"data_structure_type":3,"bar_sea_level":29.731,"bar_trend":-0.029,"bar_absolute":29.508}]},"error":null}

that ghost properly breaks down into states in the DavisWeather device. For the most part, Indigo treats this as any other device, allowing the states to be used in triggers and displayed in control pages. But when I attempted to look at the history in Postgres last week, I found that although the device table exists, the only headings were device online, timestampupdated, devicetimestamp, and deviceError and parse error. All the device_condition_0 items shown in the dialog were missing and there was no data in the table. Is this an oversight or a bug?

Re: GhostXML and PostgreSQL

PostPosted: Fri Mar 08, 2024 3:58 pm
by DaveL17
johnpolasek wrote:
Why do GhostXML "devices" not post to the Postgres data base?

There is a setting within the device configuration called "Disable SQL Logging" which keeps data from a GhostXML device from being queried by the SQL plugin. Setting this field to true adds a flag ("sqlLoggerIgnoreStates") to the device which tells the SQL Logger to skip the device when creating/updating tables.

GhostXML Wiki: https://github.com/IndigoDomotics/GhostXML/wiki/devices

SQL Logger Plugin: https://forums.indigodomo.com/viewtopic.php?t=24749

johnpolasek wrote:
Is this an oversight or a bug?

Neither, although there could be a bug in the way this is implemented that I've not been made aware of. I haven't received any bug reports for this and I don't use SQL logging myself, so this is the first I've heard of anything with respect to this setting.

Re: GhostXML and PostgreSQL

PostPosted: Fri Mar 08, 2024 5:08 pm
by FlyingDiver
johnpolasek wrote:
Why do GhostXML "devices" not post to the Postgres data base? I use GhostXML to query my local Davis weather station's API, which I query query every 5 minutes with http://<IP of Station>/v1/current_conditions and get back


Just FYI, there is a plugin for Davis Weatherstations. It was specifically developed for the WeatherLink Live device, but it should work with any Davis console that supports the HTTP queries.

Re: GhostXML and PostgreSQL

PostPosted: Sat Mar 09, 2024 5:05 am
by johnpolasek
Turning off the disable SQL fixed it... Thanks. And once upon a time long ago, I did use the weather link, but as I recall, it actually queried the Davis cloud database that the console was exporting rather than accessing the local station and our internet was a bit unreliable.

Re: GhostXML and PostgreSQL

PostPosted: Sat Mar 09, 2024 6:21 am
by DaveL17
johnpolasek wrote:
Turning off the disable SQL fixed it

Excellent. Thanks for letting me know.

Re: GhostXML and PostgreSQL

PostPosted: Sat Mar 09, 2024 7:20 am
by FlyingDiver
johnpolasek wrote:
And once upon a time long ago, I did use the weather link, but as I recall, it actually queried the Davis cloud database that the console was exporting rather than accessing the local station and our internet was a bit unreliable.


Then that was a different plugin. Mine doesn't do that.
.