• 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
pilight-send or pilight-control --> update config.json
Hi community!

I regulate a dimmlevel with an python script.
The Script takes the data whitch my DHT11 writes into config.json and dimms the lamps if it is too hot or too cold. (Not for me - for my bearded dragons in the terrarium)

This works very well.

The only thing i cant do is update the config.json with the new dimmlevel to show it in the webgui and get the last status for the next call of the python script.

When i use pilight-send or pilight-control i can dimm and the changes are shown in the webgui but the config.json will not be updated.

I think the problem is that the config.json is write protected when the pilight service is running.
Is there any way to write into config.json when using python and the pilight service is running?

Thanks for help!

best regards
Indeed, the config.json is only updated on start and shutdown to prevent disk IO. All updates are kept in memory. You can however request the latest config from pilight by using the API or by going to http://x.x.x.x/config

Thank you for this Information!

The hint with the url works well for me.
I read and use the actual data with this code from python:

import urllib2
import json
req = urllib2.Request("")
opener = urllib2.build_opener()
f = opener.open(req)
config = json.loads(f.read())

print config['config']['room']['device']['temperature']

best regards
Of course, using the API would be cleaner.

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Solved] pilight service crashing on first webserver access after reboot VrahoK 20 437 12-21-2019, 09:46 AM
Last Post: curlymo
  pilight-control modify values coolinx 16 564 11-13-2019, 08:02 PM
Last Post: curlymo
  Bug: double free or corruption in pilight-send blackzombie 12 549 10-07-2019, 08:15 PM
Last Post: blackzombie
  [Fixed] High CPU usage when pilight usb nano disconnects DieterK 1 254 08-13-2019, 05:43 PM
Last Post: curlymo
  pilight Nano USB interface curlymo 228 103,736 07-10-2019, 06:14 PM
Last Post: curlymo
  problems compiling pilight on Odroid C2 WitchDoctor 101 12,362 03-14-2019, 09:01 PM
Last Post: curlymo
  Issue send actions over Socket API in AdHoc network ggtrts 10 1,142 03-13-2019, 06:32 AM
Last Post: curlymo
  Send pulsestream via API Phunkafizer 19 1,516 02-27-2019, 09:54 PM
Last Post: curlymo
  pilight 8 what chages for custom protocols? polo 11 3,384 02-15-2019, 06:22 PM
Last Post: polo
  Update to 8.1.3-18-gab88dcf3 Traeumer 10 1,625 11-01-2018, 10:42 PM
Last Post: Oliver

Forum Jump:

Browsing: 1 Guest(s)