• 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
  pilight bugs Ascenion 1 45 03-23-2020, 06:29 PM
Last Post: curlymo
  [Solved] pilight service crashing on first webserver access after reboot VrahoK 20 949 12-21-2019, 09:46 AM
Last Post: curlymo
  pilight-control modify values coolinx 16 882 11-13-2019, 08:02 PM
Last Post: curlymo
  Bug: double free or corruption in pilight-send blackzombie 12 842 10-07-2019, 08:15 PM
Last Post: blackzombie
  [Fixed] High CPU usage when pilight usb nano disconnects DieterK 1 340 08-13-2019, 05:43 PM
Last Post: curlymo
  pilight Nano USB interface curlymo 228 108,253 07-10-2019, 06:14 PM
Last Post: curlymo
  problems compiling pilight on Odroid C2 WitchDoctor 101 14,449 03-14-2019, 09:01 PM
Last Post: curlymo
  Issue send actions over Socket API in AdHoc network ggtrts 10 1,385 03-13-2019, 06:32 AM
Last Post: curlymo
  Send pulsestream via API Phunkafizer 19 1,927 02-27-2019, 09:54 PM
Last Post: curlymo
  pilight 8 what chages for custom protocols? polo 11 3,780 02-15-2019, 06:22 PM
Last Post: polo

Forum Jump:

Browsing: 1 Guest(s)