• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Big configuration & API rewrite
#1
For those using the latest development branch. Please check this page for documentation:
http://www.pilight.org/nightly/
 
Reply
#2
Just started to migrate to the new dev version with the very much changed json structure. (Not a very nice job so far because the different/new device/gui structure need a massive re-write Unsure)

One point I run into is this error:
Code:
pilight-daemon: ERROR: config device #4 "Stehlampe_WZ_1B", not alphanumeric
failed!
To have as a reminder which key on which remote control can be used also I had
Code:
"name": "Stehlampe WZ (1.B)",

I tried to change to
Code:
"Stehlampe_WZ_1B": {
but also the underline is obmitted.
From a code/json perspective I don't see that's necessary.

Could that be changed here to support at least underscore (or more other chars also)?
 
Reply
#3
Yes, that could be an option if it's really required Smile Notice that the key requirements changed a long time ago. Has not much to do with the new config structure.... I also made everything so that eventually everything makes more sense. Ask me for help if you can't see it Wink
 
Reply
#4
Do you plan eventually for
-- a batch/?? to convert from previous different configure json's to the new one's
-- also generate from previous setup to a standard gui json

This would help (standard) users to easily upgrade to your next/new version

And once more, how about the owner/access rights for config.json. To work with those with other programs (like py) I had to change chmod/chown manually

Guenter
 
Reply
#5
No and no.

I have this stuff in development so developers can adapt until it reaches master. And as i said, the change is less radical as you might think. I of course updated Illumina and the webgui myself, and it wasn't that difficult. I also communicate the pilight version in the API so app developers can check it to inform users if the new version is already supported or not.

About the batch conversion. I don't feel the need because you just copy the hardware.json and settings.json content and copy to the new config.json.

If users were strict in using the API, the new config doesn't require much change. And think about the oppurtonities. In the old versions, the settings and hardware info wasn't readible by the app developers.
 
Reply
#6
With http://www.pilight.org/nightly_devices/ you have:
Quote:mobile, web, desktop, all

Are those just palceholders or are they differently handled for the html code?
 
Reply
#7
Currently, it's up to the app developers to respect this information. Illumina and the webgui do of course respect the setting and will or will not parse devices based on that information. I will add a function in the identification process so an external app can tell pilight what type of platform it is (web, mobile, desktop) so in the final configuration only those devices will be communicated in respect to this setting.
 
Reply
#8
More observations ..

After setting up config.json with devices and gui a call for the config with http://192.168.178.16:5001/config I get the json back:
Code:
{"devices":{"Haustuer":{"uuid":"0000-80-1f-02-d34fd0","origin":"0000-80-1f-02-d34fd0","timestamp":0,"protocol":["pollin"],"id":[{"systemcode":21,"unitcode":1}],"state":"on"},"Bad":{"uuid":"0000-80-1f-02-d34fd0","origin":"0000-80-1f-02-d34fd0","timestamp":1416783872,"protocol":["pollin"],"id":[{"systemcode":21,"unitcode":2}],"state":"off"},"FlurDecke":{"uuid":"0000-80-1f-02-d34fd0","origin":"0000-80-1f-02-d34fd0","timestamp":0,"protocol":["pollin"],"id":[{"systemcode":17,"unitcode":1}],"state":"off"},"Stehlampe":{"uuid":"0000-80-1f-02-d34fd0","origin":"0000-80-1f-02-d34fd0","timestamp":0,"protocol":["pollin"],"id":[{"systemcode":17,"unitcode":2}],"state":"off"},"Kueche":{"uuid":"0000-80-1f-02-d34fd0","origin":"0000-80-1f-02-d34fd0","timestamp":0,"protocol":["pollin"],"id":[{"systemcode":17,"unitcode":4}],"state":"off"},"SteckerC":{"uuid":"0000-80-1f-02-d34fd0","origin":"0000-80-1f-02-d34fd0","timestamp":0,"protocol":["pollin"],"id":[{"systemcode":21,"unitcode":4}],"state":"off"},"SteckerD":{"uuid":"0000-80-1f-02-d34fd0","origin":"0000-80-1f-02-d34fd0","timestamp":0,"protocol":["pollin"],"id":[{"systemcode":21,"unitcode":8}],"state":"off"}},"rules":{},"gui":{"Haustuer":{"type":1,"order":1,"name":"Haustuer (5.A)","group":["Hausbeleuchtung"],"media":["all"],"readonly":0},"Bad":{"type":1,"order":2,"name":"Bad (5.B)","group":["Hausbeleuchtung"],"media":["all"],"readonly":0},"FlurDecke":{"type":1,"order":3,"name":"Flur Decke (1.A)","group":["Zwischengeschoss"],"media":["all"],"readonly":0},"Stehlampe":{"type":1,"order":4,"name":"Stehlampe WZ (1.B)","group":["Erdgeschoss"],"media":["all"],"readonly":0},"Kueche":{"type":1,"order":5,"name":"Kueche Schrankleuchte (1.C)","group":["Erdgeschoss"],"media":["all"],"readonly":0}},"settings":{"log-level":4,"pid-file":"/var/run/pilight.pid","log-file":"/var/log/pilight.log","send-repeats":10,"receive-repeats":1,"webserver-enable":1,"webserver-root":"/usr/local/share/pilight/","webserver-port":5001,"webserver-cache":1,"firmware-update":0},"hardware":{"433gpio":{"sender":0,"receiver":1}},"registry":{"pilight":{"version":{"current":"5.0"}}}}
All devices have the same UUID and Origin. Is that OK?

On the web gui I see all groups with all defined devices with their on/off switch. Switching on the web gui does nothing with the switch.

Also I tried what I did with the previous dev version:
Code:
http://192.168.178.16:5001/send?{%22message%22:%22send%22,%22code%22:{%22location%22:%22Erdgeschoss%22,%22device%22:%22Kueche%22,%22state%22:%22on%22}}
No reaction on the switch.
 
Reply
#9
The same UUID and origin is fine.

Can you post a pilight-daemon debug mode output when switching the webgui switches?
 
Reply
#10
OK, finally (after killing one daemon) here is the gdb output:
Code:
[Nov 24 01:15:09:698644] pilight-daemon: DEBUG: broadcasted: {"values":{"cpu":0.1632645130157475,"ram":0.5939302444458026},"origin":"core","type":-1,"uuid":"0000-80-1f-02-d34fd0"}
[Nov 24 01:15:12:705080] pilight-daemon: DEBUG: cpu: 0.173132% ram: 0.593930%
[Nov 24 01:15:12:708342] pilight-daemon: DEBUG: socket write succeeded: {"values":{"cpu":0.1731320619583134,"ram":0.5939302444458026},"origin":"core","type":-1,"uuid":"0000-80-1f-02-d34fd0"}

[Nov 24 01:15:12:711114] pilight-daemon: DEBUG: broadcasted: {"values":{"cpu":0.1731320619583134,"ram":0.5939302444458026},"origin":"core","type":-1,"uuid":"0000-80-1f-02-d34fd0"}
[Nov 24 01:15:15:587486] pilight-daemon: DEBUG: socket write succeeded: {"action":"control","code":{"device":"Bad","state":"on"}}

[Nov 24 01:15:15:588399] pilight-daemon: DEBUG: socket recv: {"action":"control","code":{"device":"Bad","state":"on"}}
[Nov 24 01:15:15:594270] pilight-daemon: DEBUG: socket write succeeded: {"status":"success"}

[Nov 24 01:15:15:594755] pilight-daemon: DEBUG: **** RAW CODE ****
301 903 301 903 301 903 903 301 301 903 301 903 301 903 903 301 301 903 301 903 301 903 903 301 301 903 301 903 301 903 903 301 301 903 903 301 301 903 903 301 301 903 903 301 301 903 903 301 301 10234
[Nov 24 01:15:15:595289] pilight-daemon: DEBUG: **** RAW CODE ****
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  MQTT external Broker (not local) configuration nicky 3 215 06-02-2020, 05:00 PM
Last Post: curlymo
  Configuration example with program and ACTION to control MPD tomk 0 805 09-12-2017, 07:02 PM
Last Post: tomk
  Time to handle configuration edits properly amahlaka 4 1,486 03-19-2017, 04:26 PM
Last Post: pilino1234
  Rewrite: API not working? alexschomb 13 5,207 07-03-2016, 09:13 AM
Last Post: curlymo
  Nexa doorbell (arctech) device configuration m0rph13 2 1,634 06-09-2016, 07:05 AM
Last Post: m0rph13
  configuration of pilight v7 noxx 28 11,276 07-07-2015, 08:43 PM
Last Post: diman87
  [Questions]Some issues with configuration temp 2 2,016 06-14-2015, 06:39 PM
Last Post: pilino1234

Forum Jump:


Browsing: 1 Guest(s)