domoticz | Open source Home Automation System

 by   domoticz C++ Version: 2023.1 License: GPL-3.0

kandi X-RAY | domoticz Summary

domoticz is a C++ library typically used in Internet of Things (IoT), Raspberry Pi applications. domoticz has no bugs, it has a Strong Copyleft License and it has medium support. However domoticz has 2 vulnerabilities. You can download it from GitHub.
Domoticz is a Home Automation System that lets you monitor and configure various devices like: Lights, Switches, various sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water and much more. Notifications/Alerts can be sent to any mobile device.
    Support
      Quality
        Security
          License
            Reuse
            Support
              Quality
                Security
                  License
                    Reuse

                      kandi-support Support

                        summary
                        domoticz has a medium active ecosystem.
                        summary
                        It has 3244 star(s) with 1126 fork(s). There are 218 watchers for this library.
                        summary
                        There were 2 major release(s) in the last 6 months.
                        summary
                        There are 89 open issues and 2639 have been closed. On average issues are closed in 10 days. There are 4 open pull requests and 0 closed requests.
                        summary
                        It has a neutral sentiment in the developer community.
                        summary
                        The latest version of domoticz is 2023.1
                        domoticz Support
                          Best in #C++
                            Average in #C++
                            domoticz Support
                              Best in #C++
                                Average in #C++

                                  kandi-Quality Quality

                                    summary
                                    domoticz has 0 bugs and 0 code smells.
                                    domoticz Quality
                                      Best in #C++
                                        Average in #C++
                                        domoticz Quality
                                          Best in #C++
                                            Average in #C++

                                              kandi-Security Security

                                                summary
                                                domoticz has 2 vulnerability issues reported (1 critical, 1 high, 0 medium, 0 low).
                                                summary
                                                domoticz code analysis shows 0 unresolved vulnerabilities.
                                                summary
                                                There are 0 security hotspots that need review.
                                                domoticz Security
                                                  Best in #C++
                                                    Average in #C++
                                                    domoticz Security
                                                      Best in #C++
                                                        Average in #C++

                                                          kandi-License License

                                                            summary
                                                            domoticz is licensed under the GPL-3.0 License. This license is Strong Copyleft.
                                                            summary
                                                            Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.
                                                            domoticz License
                                                              Best in #C++
                                                                Average in #C++
                                                                domoticz License
                                                                  Best in #C++
                                                                    Average in #C++

                                                                      kandi-Reuse Reuse

                                                                        summary
                                                                        domoticz releases are available to install and integrate.
                                                                        summary
                                                                        Installation instructions are available. Examples and code snippets are not available.
                                                                        domoticz Reuse
                                                                          Best in #C++
                                                                            Average in #C++
                                                                            domoticz Reuse
                                                                              Best in #C++
                                                                                Average in #C++
                                                                                  Top functions reviewed by kandi - BETA
                                                                                  kandi has reviewed domoticz and discovered the below as its top functions. This is intended to give you an instant insight into domoticz implemented functionality, and help decide if they suit your requirements.
                                                                                  • ZWave controller
                                                                                    • Show the wind graph
                                                                                      • Creates a new refresher instance .
                                                                                        • Display in air flow
                                                                                          • Initialize Ecc3 .
                                                                                            • Parses XML data from XML
                                                                                              • Show rainbar log
                                                                                                • Shows the bar page
                                                                                                  • Display day log
                                                                                                    • show user log
                                                                                                      Get all kandi verified functions for this library.
                                                                                                      Get all kandi verified functions for this library.

                                                                                                      domoticz Key Features

                                                                                                      Open source Home Automation System

                                                                                                      domoticz Examples and Code Snippets

                                                                                                      No Code Snippets are available at this moment for domoticz.
                                                                                                      Community Discussions

                                                                                                      Trending Discussions on domoticz

                                                                                                      Domoticz virtual sensor: how to set initial value
                                                                                                      chevron right
                                                                                                      K3S SQLite slow on NFS
                                                                                                      chevron right
                                                                                                      How to install Git package on WIndows with python
                                                                                                      chevron right
                                                                                                      SyntaxError: invalid syntax on python script
                                                                                                      chevron right
                                                                                                      Mosquitto: Starting in local only mode but can't fix
                                                                                                      chevron right
                                                                                                      Issues with turning json data into an variable in python
                                                                                                      chevron right
                                                                                                      Bin bash: Launch python file with given sh file arguments
                                                                                                      chevron right
                                                                                                      Which python script is executed if directory path is passed as command line argument to python?
                                                                                                      chevron right

                                                                                                      QUESTION

                                                                                                      Domoticz virtual sensor: how to set initial value
                                                                                                      Asked 2022-Mar-25 at 15:52

                                                                                                      I have a device that reads the P1 port of a smart meter. I have created a virtual sensor for the smart meter and, through a simple shell script, I can set the meter readings in Domoticz. This works well.

                                                                                                      However, for the devices (both electricity and gas), I get a large peak of consumption on the first period. That is because the virtual sensor is initialized with the values of 0 for all the counters. This gives a peak that makes the graphs unusable.

                                                                                                      Is there a way to initialize the meter reading on a non-zero value?

                                                                                                      ANSWER

                                                                                                      Answered 2022-Mar-25 at 15:52

                                                                                                      Domoticz uses an sqlite3 database. With sqlite3 domoticz.db '.dump' > domo.dump, you can get a complete dump of the database. Searching for the index of the meter, I found the initial value (for the gas meter:)

                                                                                                       INSERT INTO Meter VALUES(1093,0,0,'2022-03-24 18:00:00');
                                                                                                      

                                                                                                      Removing that row from the Meter table did the trick.

                                                                                                      Source https://stackoverflow.com/questions/71606798

                                                                                                      QUESTION

                                                                                                      K3S SQLite slow on NFS
                                                                                                      Asked 2022-Feb-20 at 19:47

                                                                                                      I have an application running on my home cluster.
                                                                                                      My cluster is running K3S.
                                                                                                      The cluster exists of 5 Raspberry Pi's 3B and 1 Ubuntu VM.
                                                                                                      One of my deployments is Domoticz.
                                                                                                      This uses a SQLite database to store data.
                                                                                                      I'm using this as a StorageClass. https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner
                                                                                                      The NFS is hosted in OpenMediaVault with arguments subtree_check,insecure,no_root_squash

                                                                                                      When I store this database (14MB) on a PV volume linked to an NFS Storage Class, the applications becomes very slow.
                                                                                                      When I use the Storage Class local-path, the application is as fast.
                                                                                                      Problem is now that when that node dies, the Deployment doesn't start because of the node-affinity linked to the PVC.
                                                                                                      I'm out of idea's to fix this issue.

                                                                                                      Is there another SC better suited to my setup?
                                                                                                      Is there a tweak to the SC local-path, so it's not linked to a node? (yes I know, database will not be transferred to the new node)

                                                                                                      ANSWER

                                                                                                      Answered 2022-Feb-20 at 19:47

                                                                                                      I fixed this by using longhorn instead of NFS. Thanks Andrew Skorkin for the tip

                                                                                                      Source https://stackoverflow.com/questions/71122901

                                                                                                      QUESTION

                                                                                                      How to install Git package on WIndows with python
                                                                                                      Asked 2021-Jul-23 at 18:12

                                                                                                      I am trying to install a plugin from Domoticz, and I need to do it via python, but I'm new to the python terminal. I am trying to do the following command

                                                                                                      pip install git+https://mygithublink#egg=name
                                                                                                      

                                                                                                      but I get the following error:

                                                                                                      ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
                                                                                                      

                                                                                                      Thanks beforehand! Best regards Max

                                                                                                      ANSWER

                                                                                                      Answered 2021-Jul-23 at 10:22

                                                                                                      When you pip install from git repo, the first thing pip will do is to clone the git repo, which will fail if you don't have git tools installed already.

                                                                                                      Source https://stackoverflow.com/questions/68497360

                                                                                                      QUESTION

                                                                                                      SyntaxError: invalid syntax on python script
                                                                                                      Asked 2021-Apr-27 at 07:28

                                                                                                      I'm not familiar with Python, but I made the following script with searching on Google.

                                                                                                      The script pulls out data from a device and injects it in Domoticz. When I run the script on my Windows machine, every minute it loops correctly and injects the data into Domoitcz. When I run the same script on my Raspberry Pi, it returns a SyntaxError: invalid syntax (line 155) on the except Exception line...

                                                                                                      Even if I put a # before that line it raises an error.

                                                                                                      #!/usr/bin/env python3
                                                                                                      
                                                                                                      from APSystemsECUR import APSystemsECUR
                                                                                                      import time
                                                                                                      import asyncio
                                                                                                      import urllib.request
                                                                                                      import urllib.parse
                                                                                                      import urllib
                                                                                                      from pprint import pprint
                                                                                                      
                                                                                                      
                                                                                                      ecu_ip = "192.168.178.xx"
                                                                                                      sleep = 60
                                                                                                      
                                                                                                      url = 'http://192.168.178.xx:8080/json.htm?'
                                                                                                      puntcomma = '\u003B'
                                                                                                      
                                                                                                      loop = asyncio.get_event_loop()
                                                                                                      ecu = APSystemsECUR(ecu_ip)
                                                                                                      
                                                                                                      while True:
                                                                                                              try:
                                                                                                                      data = loop.run_until_complete(ecu.async_query_ecu())
                                                                                                                      #pprint(data)
                                                                                                      
                                                                                                                      today_energy_kwh = str(data.get('today_energy')*1000)
                                                                                                                      print('Today energy [kWh]: ' + today_energy_kwh)
                                                                                                                      getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 212, 'svalue': (today_energy_kwh)}
                                                                                                                      webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars))
                                                                                                                      #print(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                      
                                                                                                                      getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 213, 'svalue': data.get('current_power')}
                                                                                                                      webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')     
                                                                                                                      #print(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                      
                                                                                                                      getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 195, 'svalue': data.get('timestamp')}
                                                                                                                      webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars))
                                                                                                                      #print(url + urllib.parse.urlencode(getVars))
                                                                                                      #inverter values
                                                                                                                      inverters = data.get('inverters')
                                                                                                      #count number of inverters
                                                                                                                      Inverter_qty = len(data.get('inverters'))
                                                                                                                      print('Inverter_cnt: ' + str(Inverter_qty))
                                                                                                      # loop trough all inverters and get the data
                                                                                                                      for i in range(Inverter_qty):
                                                                                                                       Inverter = list(inverters.keys())[i]
                                                                                                                       print('InverterId: ' + Inverter)
                                                                                                                       InverterOnline = data['inverters'][Inverter]['online']
                                                                                                                       print('Online: ' + str(InverterOnline))
                                                                                                                       InverterTemperature = data['inverters'][Inverter]['temperature']
                                                                                                                       print('Temperature: ' + str(InverterTemperature))
                                                                                                                       nPower = len(data['inverters'][Inverter]['power'])
                                                                                                                       for x in range(nPower):
                                                                                                                        power = data['inverters'][Inverter]['power'][x]
                                                                                                                        print('Power inverter ' + str(i + 1) + ' panel ' + str(x + 1) + ': ' + str(power) + ' W')
                                                                                                      
                                                                                                      #upload values to Domoticz voor inverter 1
                                                                                                                        if (i == 0) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 173, 'svalue': InverterTemperature}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars))
                                                                                                                         if InverterOnline == True :
                                                                                                                          getVars = {'type' : 'command', 'param' : 'switchlight', 'idx': 174, 'switchcmd': 'On', 'level': 0, 'passcode': '' }
                                                                                                                         else :
                                                                                                                          getVars = {'type' : 'command', 'param' : 'switchlight', 'idx': 174, 'switchcmd': 'Off', 'level': 0, 'passcode': '' }
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars))
                                                                                                      
                                                                                                      #upload values to Domoticz voor inverter 2
                                                                                                                        if (i == 1) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 179, 'svalue': InverterTemperature}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars))
                                                                                                                         if InverterOnline == True :
                                                                                                                          getVars = {'type' : 'command', 'param' : 'switchlight', 'idx': 180, 'switchcmd': 'On', 'level': 0, 'passcode': '' }
                                                                                                                         else :
                                                                                                                          getVars = {'type' : 'command', 'param' : 'switchlight', 'idx': 180, 'switchcmd': 'Off', 'level': 0, 'passcode': '' }
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars))
                                                                                                      
                                                                                                      #upload values to Domoticz voor inverter 3
                                                                                                                        if (i == 2) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 185, 'svalue': InverterTemperature}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars))
                                                                                                                         if InverterOnline == True :
                                                                                                                          getVars = {'type' : 'command', 'param' : 'switchlight', 'idx': 186, 'switchcmd': 'On', 'level': 0, 'passcode': '' }
                                                                                                                         else :
                                                                                                                          getVars = {'type' : 'command', 'param' : 'switchlight', 'idx': 186, 'switchcmd': 'Off', 'level': 0, 'passcode': '' }
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars))
                                                                                                      
                                                                                                      #upload values to Domoticz voor inverter 4
                                                                                                                        if (i == 3) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 191, 'svalue': InverterTemperature}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars))
                                                                                                                         if InverterOnline == True :
                                                                                                                          getVars = {'type' : 'command', 'param' : 'switchlight', 'idx': 192, 'switchcmd': 'On', 'level': 0, 'passcode': '' }
                                                                                                                         else :
                                                                                                                          getVars = {'type' : 'command', 'param' : 'switchlight', 'idx': 192, 'switchcmd': 'Off', 'level': 0, 'passcode': '' }
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars))
                                                                                                      
                                                                                                      #upload power values to Domoticz voor inverter 1
                                                                                                                        if (i == 0) and (x == 0) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 196, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                        elif (i == 0) and (x == 1) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 197, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                        elif (i == 0) and (x == 2) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 198, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                        elif (i == 0) and (x == 3) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 199, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                      
                                                                                                      #upload power values to Domoticz voor inverter 2
                                                                                                                        if (i == 1) and (x == 0) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 200, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                        elif (i == 1) and (x == 1) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 201, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                        elif (i == 1) and (x == 2) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 202, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                        elif (i == 1) and (x == 3) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 203, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                      
                                                                                                      #upload power values to Domoticz voor inverter 3
                                                                                                                        if (i == 2) and (x == 0) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 204, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                        elif (i == 2) and (x == 1) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 205, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                        elif (i == 2) and (x == 2) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 206, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                        elif (i == 2) and (x == 3) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 207, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                      
                                                                                                      #upload power values to Domoticz voor inverter 4
                                                                                                                        if (i == 3) and (x == 0) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 208, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                        elif (i == 3) and (x == 1) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 209, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                        elif (i == 3) and (x == 2) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 210, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                                        elif (i == 3) and (x == 3) :
                                                                                                                         getVars = {'type' : 'command', 'param' : 'udevice', 'nvalue' : 0, 'idx': 211, 'svalue': (power)}
                                                                                                                         webUrl = urllib.request.urlopen(url + urllib.parse.urlencode(getVars) + (puntcomma) + '0')
                                                                                                      
                                                                                                      
                                                                                                              except Exception as err:
                                                                                                                      print(f"[ERROR]", {err})
                                                                                                      
                                                                                                              #print(f"Sleeping for {sleep} sec")
                                                                                                              time.sleep(sleep)
                                                                                                      

                                                                                                      Why does it work on my Windows machine correctly and not on the Raspberry Pi?

                                                                                                      ANSWER

                                                                                                      Answered 2021-Apr-27 at 04:54

                                                                                                      The line raising the error is a print statement which is using an f-string (e.g. f"{variable_name}"). F-strings were introduced in Python 3.6, so my guess is that your raspberry pi is using a version earlier than that, and your windows machine isn't.

                                                                                                      Try checking what version of python is running on your raspberry pi (python --version from a terminal). If it's anything earlier than 3.6, the f-strings will cause you syntax errors everywhere in the code.

                                                                                                      The only other issue I can think of is you might actually be running python 2.7 with the default python command (I can't remember off the top of my head if rasbian does this like some distros). If you get 2.7 with the version check above, try using python3 and check that version. You will need to be running that script with at least 3.6 for that script to execute.

                                                                                                      Incidentally, you have another f-string on line 156, which might explain why if you commented out 155, it raises the exact same syntax error :)

                                                                                                      Source https://stackoverflow.com/questions/67277075

                                                                                                      QUESTION

                                                                                                      Mosquitto: Starting in local only mode but can't fix
                                                                                                      Asked 2021-Feb-27 at 14:40

                                                                                                      My Rpi4 running my home automation recently upgraded itself from mosquitto version 1.6.12 to 2.0.8 and as a consequence it was starting in local only mode.

                                                                                                      Done some digging about but still can't get it all working again, mainly used this previous helpful question Mosquitto: Starting in local only mode but my devices still can't connect.

                                                                                                      From my mosquiito log I see

                                                                                                      1614386087: mosquitto version 2.0.8 starting
                                                                                                      1614386087: Config loaded from /etc/mosquitto/mosquitto.conf.
                                                                                                      1614386087: Opening ipv4 listen socket on port 1883.
                                                                                                      1614386087: Opening ipv6 listen socket on port 1883.
                                                                                                      1614386087: mosquitto version 2.0.8 running
                                                                                                      

                                                                                                      The service shows this

                                                                                                      :~$ sudo systemctl status mosquitto
                                                                                                      * mosquitto.service - Mosquitto MQTT Broker
                                                                                                         Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
                                                                                                         Active: active (running) since Sat 2021-02-27 00:34:47 GMT; 10h ago
                                                                                                           Docs: man:mosquitto.conf(5)
                                                                                                                 man:mosquitto(8)
                                                                                                        Process: 375 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
                                                                                                        Process: 398 ExecStartPre=/bin/chown mosquitto: /var/log/mosquitto (code=exited, status=0/SUCCESS)
                                                                                                        Process: 404 ExecStartPre=/bin/mkdir -m 740 -p /var/run/mosquitto (code=exited, status=0/SUCCESS)
                                                                                                        Process: 411 ExecStartPre=/bin/chown mosquitto: /var/run/mosquitto (code=exited, status=0/SUCCESS)
                                                                                                       Main PID: 419 (mosquitto)
                                                                                                         Memory: 1.5M
                                                                                                         CGroup: /system.slice/mosquitto.service
                                                                                                                 `-419 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
                                                                                                      
                                                                                                      Feb 27 00:34:47 Vero4K systemd[1]: Starting Mosquitto MQTT Broker...
                                                                                                      Feb 27 00:34:47 Vero4K mosquitto[419]: 1614386087: Loading config file /etc/mosquitto/conf.d/calz.conf
                                                                                                      Feb 27 00:34:47 Vero4K systemd[1]: Started Mosquitto MQTT Broker.
                                                                                                      

                                                                                                      In my calz.conf file I have

                                                                                                      listener 1883
                                                                                                      allow_anonymous true
                                                                                                      

                                                                                                      But my local version of Domoticz (runs on the same box) shows this in it's logs

                                                                                                      Error: Plugin: Connection Exception: 'resolve: Host not found (authoritative)' connecting to '127.0.0.1:1883'
                                                                                                      Error: (ShellyMQTT) Failed to connect to: 127.0.0.1:1883, Description: resolve: Host not found (authoritative)
                                                                                                      

                                                                                                      And all my Tasmota devices now show

                                                                                                      14:49:38 MQT: Attempting connection...
                                                                                                      14:49:38 MQT: Connect failed to 192.168.1.19:1883, rc -2. Retry in 120 sec
                                                                                                      

                                                                                                      I can see the port open as well

                                                                                                      sudo netstat -tulpn | grep LISTEN
                                                                                                      tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      361/vsftpd
                                                                                                      tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      729/sshd
                                                                                                      tcp        0      0 0.0.0.0:37015           0.0.0.0:*               LISTEN      -
                                                                                                      tcp        0      0 0.0.0.0:36666           0.0.0.0:*               LISTEN      608/kodi.bin
                                                                                                      tcp        0      0 0.0.0.0:36667           0.0.0.0:*               LISTEN      608/kodi.bin
                                                                                                      tcp        0      0 0.0.0.0:1883            0.0.0.0:*               LISTEN      375/mosquitto
                                                                                                      tcp        0      0 0.0.0.0:49472           0.0.0.0:*               LISTEN      763/rpc.statd
                                                                                                      tcp        0      0 0.0.0.0:9090            0.0.0.0:*               LISTEN      608/kodi.bin
                                                                                                      tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/init
                                                                                                      tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      608/kodi.bin
                                                                                                      tcp6       0      0 :::22                   :::*                    LISTEN      729/sshd
                                                                                                      tcp6       0      0 :::49079                :::*                    LISTEN      763/rpc.statd
                                                                                                      tcp6       0      0 :::36666                :::*                    LISTEN      608/kodi.bin
                                                                                                      tcp6       0      0 :::36667                :::*                    LISTEN      608/kodi.bin
                                                                                                      tcp6       0      0 :::1883                 :::*                    LISTEN      375/mosquitto
                                                                                                      tcp6       0      0 :::49919                :::*                    LISTEN      -
                                                                                                      tcp6       0      0 :::9090                 :::*                    LISTEN      608/kodi.bin
                                                                                                      tcp6       0      0 :::111                  :::*                    LISTEN      1/init
                                                                                                      tcp6       0      0 :::8080                 :::*                    LISTEN      608/kodi.bin
                                                                                                      

                                                                                                      /etc/mosquitto/mosquitto.conf

                                                                                                      # Place your local configuration in /etc/mosquitto/conf.d/
                                                                                                      #
                                                                                                      # A full description of the configuration file is at
                                                                                                      # /usr/share/doc/mosquitto/examples/mosquitto.conf.example
                                                                                                      
                                                                                                      pid_file /var/run/mosquitto/mosquitto.pid
                                                                                                      
                                                                                                      persistence true
                                                                                                      persistence_location /var/lib/mosquitto/
                                                                                                      
                                                                                                      log_dest file /var/log/mosquitto/mosquitto.log
                                                                                                      
                                                                                                      include_dir /etc/mosquitto/conf.d
                                                                                                      

                                                                                                      Any ideas?

                                                                                                      ANSWER

                                                                                                      Answered 2021-Feb-27 at 13:39

                                                                                                      Your problem is not that Mosquitto is not listening, it's that your devices are trying to resolve a hostname of 127.0.0.1:1883

                                                                                                      I suspect you have entered the host:port combination into fields that should

                                                                                                      1. Only contain a hostname/IP address
                                                                                                      2. You probably should NOT be entering 127.0.0.1 as this always points to the device it is entered on and you should be entering the IP address the broker is actually running on.

                                                                                                      Source https://stackoverflow.com/questions/66398275

                                                                                                      QUESTION

                                                                                                      Issues with turning json data into an variable in python
                                                                                                      Asked 2020-Nov-30 at 08:45

                                                                                                      I have been working on an educational project a small part of it requires me to convert a single line of json data into an variable in python 3 which I recieve from domoticz (an external open source software) however due to my skill level with json I have expierenced some issues and I am not exactly sure what im doing wrong. I did get the 200 response everytime so I assume from what I understood that means the connection isnt the issue but rather the python code. (I censored the addressed but they are correct.)

                                                                                                      The code im using:
                                                                                                      import time
                                                                                                      import re
                                                                                                      import requests
                                                                                                      from ctypes import c_int, c_char_p, byref, sizeof, c_uint16, c_int32, c_byte
                                                                                                      from ctypes import c_void_p
                                                                                                      from datetime import datetime
                                                                                                      import os
                                                                                                      import urllib.request
                                                                                                      import json
                                                                                                      import logging
                                                                                                      import sys
                                                                                                      from requests.exceptions import HTTPError
                                                                                                      logger = logging.getLogger(__name__)
                                                                                                      domoticzserver='ip'
                                                                                                      switchid='3'
                                                                                                      device='5'
                                                                                                      tempbed=str(4)
                                                                                                      def domoticzrequest (url):
                                                                                                        request = urllib.request.Request(url)
                                                                                                        response = urllib.request.urlopen(request)
                                                                                                        return response.read()
                                                                                                      import urllib.request, json 
                                                                                                      with urllib.request.urlopen("http://domoticzip/json.htm?type=devices&rid=4") as url:
                                                                                                      data = json.loads(url.read().decode())
                                                                                                          print(data)
                                                                                                      

                                                                                                      The json I get back which i can see by typing clicking the url in python:

                                                                                                      {
                                                                                                          "ActTime" : 1606722346,
                                                                                                          "AstrTwilightEnd" : "18:37",
                                                                                                          "AstrTwilightStart" : "06:23",
                                                                                                          "CivTwilightEnd" : "17:14",
                                                                                                          "CivTwilightStart" : "07:47",
                                                                                                          "DayLength" : "08:08",
                                                                                                          "NautTwilightEnd" : "17:56",
                                                                                                          "NautTwilightStart" : "07:04",
                                                                                                          "ServerTime" : "2020-11-30 08:45:46",
                                                                                                          "SunAtSouth" : "12:30",
                                                                                                          "Sunrise" : "08:26",
                                                                                                          "Sunset" : "16:34",
                                                                                                          "app_version" : "2020.2",
                                                                                                          "result" : 
                                                                                                          [
                                                                                                              {
                                                                                                                  "AddjMulti" : 1.0,
                                                                                                                  "AddjMulti2" : 1.0,
                                                                                                                  "AddjValue" : 0.0,
                                                                                                                  "AddjValue2" : 0.0,
                                                                                                                  "BatteryLevel" : 255,
                                                                                                                  "CustomImage" : 0,
                                                                                                                  "Data" : "Normal",
                                                                                                                  "Description" : "",
                                                                                                                  "Favorite" : 0,
                                                                                                                  "HardwareID" : 1,
                                                                                                                  "HardwareName" : "Domoticz Internal",
                                                                                                                  "HardwareType" : "Domoticz Internal interface",
                                                                                                                  "HardwareTypeVal" : 67,
                                                                                                                  "HaveDimmer" : false,
                                                                                                                  "HaveGroupCmd" : false,
                                                                                                                  "HaveTimeout" : false,
                                                                                                                  "ID" : "148702",
                                                                                                                  "LastUpdate" : "2020-10-19 15:10:02",
                                                                                                                  "MaxDimLevel" : 0,
                                                                                                                  "Name" : "Domoticz Security Panel",
                                                                                                                  "Notifications" : "false",
                                                                                                                  "PlanID" : "0",
                                                                                                                  "PlanIDs" : 
                                                                                                                  [
                                                                                                                      0
                                                                                                                  ],
                                                                                                                  "Protected" : false,
                                                                                                                  "ShowNotifications" : true,
                                                                                                                  "SignalLevel" : "-",
                                                                                                                  "Status" : "Normal",
                                                                                                                  "StrParam1" : "",
                                                                                                                  "StrParam2" : "",
                                                                                                                  "SubType" : "Security Panel",
                                                                                                                  "SwitchType" : "Security",
                                                                                                                  "SwitchTypeVal" : 0,
                                                                                                                  "Timers" : "false",
                                                                                                                  "Type" : "Security",
                                                                                                                  "TypeImg" : "security",
                                                                                                                  "Unit" : 0,
                                                                                                                  "Used" : 0,
                                                                                                                  "XOffset" : "0",
                                                                                                                  "YOffset" : "0",
                                                                                                                  "idx" : "2"
                                                                                                              },
                                                                                                              {
                                                                                                                  "AddjMulti" : 1.0,
                                                                                                                  "AddjMulti2" : 1.0,
                                                                                                                  "AddjValue" : 0.0,
                                                                                                                  "AddjValue2" : 0.0,
                                                                                                                  "BatteryLevel" : 255,
                                                                                                                  "CustomImage" : 0,
                                                                                                                  "Data" : "-5.0 C",
                                                                                                                  "Description" : "",
                                                                                                                  "Favorite" : 1,
                                                                                                                  "HardwareID" : 2,
                                                                                                                  "HardwareName" : "Test sensor",
                                                                                                                  "HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
                                                                                                                  "HardwareTypeVal" : 15,
                                                                                                                  "HaveTimeout" : true,
                                                                                                                  "ID" : "14053",
                                                                                                                  "LastUpdate" : "2020-11-09 09:03:34",
                                                                                                                  "Name" : "Temperatuur Kachel",
                                                                                                                  "Notifications" : "false",
                                                                                                                  "PlanID" : "0",
                                                                                                                  "PlanIDs" : 
                                                                                                                  [
                                                                                                                      0
                                                                                                                  ],
                                                                                                                  "Protected" : false,
                                                                                                                  "ShowNotifications" : true,
                                                                                                                  "SignalLevel" : "-",
                                                                                                                  "SubType" : "LaCrosse TX3",
                                                                                                                  "Temp" : -5.0,
                                                                                                                  "Timers" : "false",
                                                                                                                  "Type" : "Temp",
                                                                                                                  "TypeImg" : "temperature",
                                                                                                                  "Unit" : 1,
                                                                                                                  "Used" : 1,
                                                                                                                  "XOffset" : "0",
                                                                                                                  "YOffset" : "0",
                                                                                                                  "idx" : "3",
                                                                                                                  "trend" : 0
                                                                                                              },
                                                                                                              {
                                                                                                                  "AddjMulti" : 1.0,
                                                                                                                  "AddjMulti2" : 1.0,
                                                                                                                  "AddjValue" : 0.0,
                                                                                                                  "AddjValue2" : 0.0,
                                                                                                                  "BatteryLevel" : 255,
                                                                                                                  "CustomImage" : 0,
                                                                                                                  "Data" : "17.5",
                                                                                                                  "Description" : "",
                                                                                                                  "Favorite" : 1,
                                                                                                                  "HardwareID" : 3,
                                                                                                                  "HardwareName" : "Test switch",
                                                                                                                  "HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
                                                                                                                  "HardwareTypeVal" : 15,
                                                                                                                  "HaveTimeout" : true,
                                                                                                                  "ID" : "0014054",
                                                                                                                  "LastUpdate" : "2020-11-06 11:51:09",
                                                                                                                  "Name" : "Temperatuur gewenst",
                                                                                                                  "Notifications" : "false",
                                                                                                                  "PlanID" : "0",
                                                                                                                  "PlanIDs" : 
                                                                                                                  [
                                                                                                                      0
                                                                                                                  ],
                                                                                                                  "Protected" : false,
                                                                                                                  "SetPoint" : "17.5",
                                                                                                                  "ShowNotifications" : true,
                                                                                                                  "SignalLevel" : "-",
                                                                                                                  "SubType" : "SetPoint",
                                                                                                                  "Timers" : "false",
                                                                                                                  "Type" : "Thermostat",
                                                                                                                  "TypeImg" : "override_mini",
                                                                                                                  "Unit" : 1,
                                                                                                                  "Used" : 1,
                                                                                                                  "XOffset" : "0",
                                                                                                                  "YOffset" : "0",
                                                                                                                  "idx" : "4"
                                                                                                              }
                                                                                                          ],
                                                                                                          "status" : "OK",
                                                                                                          "title" : "Devices"
                                                                                                      }
                                                                                                      

                                                                                                      Basicly I want SetPoint(in the last tab of text also right above this) which is in this instance 17.5 as a variable in python and I will make the python code loop so it will grab that json url everytime to update the status of setpoint. But im having issues only grabbing the 17.5 to make it into a variable. I end up getting the entire json like this code is doing. or I will end up getting everything past and including the setpoint if I change some stuff. Does anyone know what im doing wrong and possibly where I should be looking for an solution? I am a bit unexpierenced with the json part of python and I have no clue where to get started as the code's I found and have tried seem to not work or give me errors. Thank you very much for your time!

                                                                                                      ANSWER

                                                                                                      Answered 2020-Nov-30 at 08:43

                                                                                                      You are getting your data stored in data ={"key": argument} as a dictionary. If you want to access a certain value you have to call for it. in Your case:

                                                                                                      SetPoint = float(data["result"][-1]["SetPoint"])
                                                                                                      

                                                                                                      To break it down:

                                                                                                      data["result"] # gives you a list which elements are dictionaries.
                                                                                                      the [-1] # calls for the last element in you list which contains the SetPoint
                                                                                                      ["SetPoint"] # then calls for the SetPoint Value which is a String "17.5"
                                                                                                      float(...) converts the string to a float value
                                                                                                      

                                                                                                      Source https://stackoverflow.com/questions/65070220

                                                                                                      QUESTION

                                                                                                      Bin bash: Launch python file with given sh file arguments
                                                                                                      Asked 2020-Jun-04 at 21:36

                                                                                                      I have relay2.sh file which should launch a python file with given arguments. So I'm using domoticz smart home system, and my task is to launch the shell script from domoticz with - script://relay2.sh 192.168.11.4 4196 1 1, arguments are - IP, PORT, RELAY, RELAY_STATUS. What I'm doing is, starting a sh file and passing arguments from domoticz to sh file. After that I'm trying to start a python file with given arguments from sh file. But it doesn't work. I really don't know how can I pass the arguments from sh to py file.

                                                                                                      Here's my sh code:

                                                                                                      #!/bin/bash
                                                                                                      echo "$1 $2 $3 $4 --test_vars-- (working)"
                                                                                                      #!/usr/bin/python3
                                                                                                      update.py $1 $2 $3 $4
                                                                                                      

                                                                                                      ANSWER

                                                                                                      Answered 2020-Jun-04 at 21:36

                                                                                                      You are using the shebang wrong. Each file may only contain one shebang (e.g. #!/bin/bash) and tells the command line interface which executable to use, when executing the script.

                                                                                                      As your script is meant to be a shell script, the shebang to use is #!/bin/bash.

                                                                                                      In order to pass the arguments to your python script, you need to call python3 update.py $1 $2 $3 $4, assuming that python3 is on your PATH variable. You can check this with echo $PATH and/or which python3

                                                                                                      If you want a pure python script to be executed from command line, you have to add the python shebang (#!/usr/bin/python) to your python file and process the arguments within that script. A good tutorial can be found here.

                                                                                                      Source https://stackoverflow.com/questions/62192871

                                                                                                      QUESTION

                                                                                                      Which python script is executed if directory path is passed as command line argument to python?
                                                                                                      Asked 2020-Feb-23 at 15:39

                                                                                                      Which script is executed if a directory is passed as argument to python (e.g. if python is called in this way: $ python3 Domoticz-Google-Assistant/)?

                                                                                                      Best regards,

                                                                                                      wewa

                                                                                                      ANSWER

                                                                                                      Answered 2020-Feb-23 at 15:39

                                                                                                      If you execute a directory as an argument to python, the file named __main__.py will be executed.

                                                                                                      Source https://stackoverflow.com/questions/60363746

                                                                                                      Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                                                                                                      Vulnerabilities

                                                                                                      No vulnerabilities reported

                                                                                                      Install domoticz

                                                                                                      You can download it from GitHub.

                                                                                                      Support

                                                                                                      Your first place for support is the Domoticz Forum. The Github issue tracker is NOT for end-user support.
                                                                                                      Find more information at:
                                                                                                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
                                                                                                      Find more libraries
                                                                                                      Explore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits​
                                                                                                      Save this library and start creating your kit

                                                                                                      Share this Page

                                                                                                      share link

                                                                                                      Reuse Pre-built Kits with domoticz

                                                                                                      Consider Popular C++ Libraries

                                                                                                      tensorflow

                                                                                                      by tensorflow

                                                                                                      electron

                                                                                                      by electron

                                                                                                      terminal

                                                                                                      by microsoft

                                                                                                      bitcoin

                                                                                                      by bitcoin

                                                                                                      opencv

                                                                                                      by opencv

                                                                                                      Try Top Libraries by domoticz

                                                                                                      domoticz-android

                                                                                                      by domoticzJava

                                                                                                      Reacticz

                                                                                                      by domoticzJavaScript

                                                                                                      domoticz-xamarin

                                                                                                      by domoticzC#

                                                                                                      Machinon

                                                                                                      by domoticzJavaScript

                                                                                                      ngx-domoboard

                                                                                                      by domoticzTypeScript

                                                                                                      Compare C++ Libraries with Highest Support

                                                                                                      tensorflow

                                                                                                      by tensorflow

                                                                                                      electron

                                                                                                      by electron

                                                                                                      pytorch

                                                                                                      by pytorch

                                                                                                      bitcoin

                                                                                                      by bitcoin

                                                                                                      godot

                                                                                                      by godotengine

                                                                                                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
                                                                                                      Find more libraries
                                                                                                      Explore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits​
                                                                                                      Save this library and start creating your kit