• 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 Nano USB interface curlymo 226 87,819 05-12-2019, 05:52 PM
Last Post: bitboy
  problems compiling pilight on Odroid C2 WitchDoctor 101 5,978 03-14-2019, 09:01 PM
Last Post: curlymo
  Issue send actions over Socket API in AdHoc network ggtrts 10 351 03-13-2019, 06:32 AM
Last Post: curlymo
  Send pulsestream via API Phunkafizer 19 452 02-27-2019, 09:54 PM
Last Post: curlymo
  pilight 8 what chages for custom protocols? polo 11 2,127 02-15-2019, 06:22 PM
Last Post: polo
  Update to 8.1.3-18-gab88dcf3 Traeumer 10 739 11-01-2018, 10:42 PM
Last Post: Oliver
  pilight-debug shows nothing minhdomanh 3 322 10-18-2018, 07:01 AM
Last Post: felfert
  pilight-send and pilight-daemon DieterK 0 411 06-20-2018, 12:44 AM
Last Post: DieterK
  Lights not switched on or off by rules in pilight 8.1.0 rorie 22 1,727 06-12-2018, 03:56 PM
Last Post: curlymo
  invalid config file when using dimlevel-minimum or dimlevel-maximum ro.m 3 407 06-12-2018, 03:54 PM
Last Post: curlymo

Forum Jump:

Browsing: 1 Guest(s)