• 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
#1
Question 
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
Manfred
 
Reply
#2
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
 
Reply
#3
Hi!

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:

Code:
import urllib2
import json
req = urllib2.Request("http://127.0.0.1:5001/config")
opener = urllib2.build_opener()
f = opener.open(req)
config = json.loads(f.read())

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

best regards
Manfred
 
Reply
#4
Of course, using the API would be cleaner.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Bug: double free or corruption in pilight-send blackzombie 12 110 10-07-2019, 08:15 PM
Last Post: blackzombie
  pilight-control modify values coolinx 2 79 09-20-2019, 07:24 PM
Last Post: coolinx
  [Fixed] High CPU usage when pilight usb nano disconnects DieterK 1 133 08-13-2019, 05:43 PM
Last Post: curlymo
  pilight Nano USB interface curlymo 228 97,159 07-10-2019, 06:14 PM
Last Post: curlymo
  problems compiling pilight on Odroid C2 WitchDoctor 101 9,741 03-14-2019, 09:01 PM
Last Post: curlymo
  Issue send actions over Socket API in AdHoc network ggtrts 10 777 03-13-2019, 06:32 AM
Last Post: curlymo
  Send pulsestream via API Phunkafizer 19 1,049 02-27-2019, 09:54 PM
Last Post: curlymo
  pilight 8 what chages for custom protocols? polo 11 2,909 02-15-2019, 06:22 PM
Last Post: polo
  Update to 8.1.3-18-gab88dcf3 Traeumer 10 1,244 11-01-2018, 10:42 PM
Last Post: Oliver
  pilight-debug shows nothing minhdomanh 3 541 10-18-2018, 07:01 AM
Last Post: felfert

Forum Jump:


Browsing: 1 Guest(s)