help with panasonic cloud

Python and python framework

Moderator: leecollings

Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

help with panasonic cloud

Post by Gianni »

hello

i'm not a programmer so i need some help with this.
I followed this guide https://www.domoticz.com/wiki/Using_Python_plugins to install this phyton script
https://github.com/muechert/python-pana ... fort-cloud

but nothing show up in domoticz.

so any help is welcome :-)
ronaldbro
Posts: 327
Joined: Thursday 15 November 2018 21:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: help with panasonic cloud

Post by ronaldbro »

This is not a Domoticz plugin, so it won't work like this.
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: help with panasonic cloud

Post by Gianni »

ow thx :lol:

so is this hard to convert to a domoticz plugin as a noob?
ronaldbro
Posts: 327
Joined: Thursday 15 November 2018 21:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: help with panasonic cloud

Post by ronaldbro »

I'm afraid so, sorry.

Have you searched the forum for Panasonic integration. Maybe there are other solutions and maybe someone already has it integrated.
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: help with panasonic cloud

Post by Gianni »

allready search for it.
Someone has integrated into HA but not for Domoticz

Grts Gianni
User avatar
FireWizard
Posts: 1862
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: help with panasonic cloud

Post by FireWizard »

Hi,

I have seen projects for OpenHab and Home Assistant.
As it can be done there, it can be done in Domoticz.

Maybe to look here: https://www.domoticz.com/forum/viewtopi ... co#p200108

Probably this script will do: https://github.com/lostfields/python-pa ... fort-cloud

If this gives the desired output on the command line, it can be pushed with MQTT to a MQTT server and with Node Red to Domoticz.

I suggest; Download the script and test it. If it is, what you want, post the results.

Regards
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: help with panasonic cloud

Post by Gianni »

Hello FireWizard

I had to change some things in the script to match with my unit but i can run it perfect from the command line.
I see my 2 inside units and can control them from the command line.
when i go to the app on my smartphone it's have the same status like ik pushed with the command line

set

Code: Select all

root@homecontrol:/home/gianni/domoticz/plugins/panasonic# python3 plugin.py login pasword set 1 -p Off
writing to device 'Living' (********************************************************id**********************************)
root@homecontrol:/home/gianni/domoticz/plugins/panasonic# python3 plugin.py login pasword set 1 -p On
writing to device 'Living' (********************************************************id**********************************)
root@homecontrol:/home/gianni/domoticz/plugins/panasonic# python3 plugin.py login pasword set 1 -t 27
get

Code: Select all

root@homecontrol:/home/gianni/domoticz/plugins/panasonic# python3 plugin.pylogin pasword get 1
reading from device 'Living'  (********************************************************id**********************************)
id                       :  ********************************************************id**********************************
parameters
    temperatureInside    : 23
    temperatureOutside   : 20
    temperature          : 27.0
    power                : On
    mode                 : Heat
    fanSpeed             : Auto
    airSwingHorizontal   : Auto
    airSwingVertical     : Auto
    eco                  : Auto
But how can i get it to domoticz :P
User avatar
FireWizard
Posts: 1862
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: help with panasonic cloud

Post by FireWizard »

Hi,

@Gianni

I see that you run the plugin.py in the ~/domoticz/plugins directory.
I suggest that you move it to another directory, e.g your home or ~/.local, as it is not a domoticz plugin and it may cause confusion.

Question: Which script is this, as I don't see a file plugin.py at: https://github.com/lostfields/python-pa ... fort-cloud or its fork at: https://github.com/muechert/python-pana ... fort-cloud.

It is important that we look to the same script

Regards
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: help with panasonic cloud

Post by Gianni »

hello

I was using a fork.
I deleted the folder from domoticz directory and downloaded the original script to my home directory
Modify the session.py and deleted 5 line's about nanoe because mine did not have this

now my get and set

Code: Select all

root@homecontrol:/home/gianni/panasonic# python3 pcomfortcloud.py login pasword get 1
reading from device 'Living' (id)
id                       : id
parameters
    temperatureInside    : 24
    temperatureOutside   : 22
    temperature          : 27.0
    power                : On
    mode                 : Heat
    fanSpeed             : Auto
    airSwingHorizontal   : Auto
    airSwingVertical     : Up
    eco                  : Auto
root@homecontrol:/home/gianni/panasonic# python3 pcomfortcloud.py login pasword set 1 -t 25
writing to device 'Living' (id)
root@homecontrol:/home/gianni/panasonic# python3 pcomfortcloud.py login pasword get 1
reading from device 'Living' (id)
id                       : id
parameters
    temperatureInside    : 24
    temperatureOutside   : 22
    temperature          : 25.0
    power                : On
    mode                 : Heat
    fanSpeed             : Auto
    airSwingHorizontal   : Auto
    airSwingVertical     : Up
    eco                  : Auto
root@homecontrol:/home/gianni/panasonic#
User avatar
FireWizard
Posts: 1862
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: help with panasonic cloud

Post by FireWizard »

Hi,

@Gianni,

That looks good.

Just to confirm, you use now https://github.com/lostfields/python-pa ... fort-cloud?

Some other questions;

Do you have a MQTT broker (server) installed, such as Mosquitto?
If not, can you install it? Various instructions are available on the Internet.

It is not necessary that the MQTT server is installed on the same hardware as Domoticz or as the Panasonic script.
Install also mosquitto-clients. This package should be installed on the same machine as your script.

Do you have a Node Red installed?
If not, can you install it? Various instructions are available on the Internet.

Regards
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: help with panasonic cloud

Post by Gianni »

idd i use this repo fro the link

mosquitto is installed on port 1883

Code: Select all

gianni@homecontrol:~$ mosquitto_sub -t "test"
message from mosquitto_pub client
test from mosquitto_pub client

Code: Select all

gianni@homecontrol:~$ node --version
v10.19.0
node red

Code: Select all

gianni@homecontrol:~$ node-red
17 May 20:10:20 - [info]

Welcome to Node-RED
===================

17 May 20:10:20 - [info] Node-RED version: v1.0.6
17 May 20:10:20 - [info] Node.js  version: v10.19.0
17 May 20:10:20 - [info] Linux 5.4.0-29-generic x64 LE
17 May 20:10:21 - [info] Loading palette nodes
17 May 20:10:22 - [info] Settings file  : /home/gianni/.node-red/settings.js
17 May 20:10:22 - [info] Context store  : 'default' [module=memory]
17 May 20:10:22 - [info] User directory : /home/gianni/.node-red
17 May 20:10:22 - [warn] Projects disabled : editorTheme.projects.enabled=false
17 May 20:10:22 - [info] Flows file     : /home/gianni/.node-red/flows_homecontrol.json
17 May 20:10:22 - [info] Creating new flow file
17 May 20:10:22 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

17 May 20:10:22 - [info] Starting flows
17 May 20:10:22 - [info] Started flows
17 May 20:10:22 - [info] Server now running at http://127.0.0.1:1880/
Node red is installed but when i go to ipadres:1880 it's not working.
ipadres only give me the ubunut default apache
ipadres:port give me my domoticz

Running everything on ubuntu server 18.04 vm on esxi host.

grts
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: help with panasonic cloud

Post by Gianni »

restart node red now working
User avatar
FireWizard
Posts: 1862
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: help with panasonic cloud

Post by FireWizard »

Hi,

@Gianni

If both Node Red and Mosquitto are installed and functioning, it is time to try to push the output from the pcomfortcloud.py script to the Mosquitto broker.
I assume, that you have also installed mosquitto-clients. If not, install it.

For a "single shot" try the following:

Open a terminal (Terminal 1)

Issue the command:

Code: Select all

/home/gianni/panasonic# python3 pcomfortcloud.py login pasword get 1 | /<path_to_mosquitto_pub/mosquitto_pub --url mqtt://127.0.0.1 -t panasonic/living -s
Open another terminal (Terminal 2)

In this terminal issue the command:

Code: Select all

mosquitto_sub -v -t panasonic/living
Check what you see in the second terminal (Terminal 2)

Regards
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: help with panasonic cloud

Post by Gianni »

if i test the code before the pipe this works.
if i get the code with the pipe i got a error
I try with the ipadres of the machine and localhost.

Code: Select all

gianni@homecontrol:/$ python3 /home/gianni/panasonic/pcomfortcloud.py login pasword get 1 | mosquitto_pub --url mqtt://ipadres server -t panasonic/living -s
Error: Invalid URL for -L argument specified - topic missing.

Use 'mosquitto_pub --help' to see usage.
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe

gianni@homecontrol:/$ python3 /home/gianni/panasonic/pcomfortcloud.py login pasword get 1 | mosquitto_pub --url mqtt://127.0.0.1 -t panasonic/living -s
Error: Invalid URL for -L argument specified - topic missing.

Use 'mosquitto_pub --help' to see usage.
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
mosquitto help

Code: Select all

gianni@homecontrol:/$ mosquitto_sub --help
mosquitto_sub is a simple mqtt client that will subscribe to a set of topics and print all messages it receives.
mosquitto_sub version 1.6.9 running on libmosquitto 1.6.9.

Usage: mosquitto_sub {[-h host] [-p port] [-u username] [-P password] -t topic | -L URL [-t topic]}
                     [-c] [-k keepalive] [-q qos]
                     [-C msg_count] [-E] [-R] [--retained-only] [--remove-retained] [-T filter_out] [-U topic ...]
                     [-F format]
                     [-W timeout_secs]
                     [-A bind_address]
                     [-i id] [-I id_prefix]
                     [-d] [-N] [--quiet] [-v]
                     [--will-topic [--will-payload payload] [--will-qos qos] [--will-retain]]
                     [{--cafile file | --capath dir} [--cert file] [--key file]
                       [--ciphers ciphers] [--insecure]
                       [--tls-alpn protocol]
                       [--tls-engine engine] [--keyform keyform] [--tls-engine-kpass-sha1]]
                     [--psk hex-key --psk-identity identity [--ciphers ciphers]]
                     [--proxy socks-url]
                     [-D command identifier value]
       mosquitto_sub --help

 -A : bind the outgoing socket to this host/ip address. Use to control which interface
      the client communicates over.
 -c : disable 'clean session' (store subscription and pending messages when client disconnects).
 -C : disconnect and exit after receiving the 'msg_count' messages.
 -d : enable debug messages.
 -D : Define MQTT v5 properties. See the documentation for more details.
 -E : Exit once all subscriptions have been acknowledged by the broker.
 -F : output format.
 -h : mqtt host to connect to. Defaults to localhost.
 -i : id to use for this client. Defaults to mosquitto_sub_ appended with the process id.
 -I : define the client id as id_prefix appended with the process id. Useful for when the
      broker is using the clientid_prefixes option.
 -k : keep alive in seconds for this client. Defaults to 60.
 -L : specify user, password, hostname, port and topic as a URL in the form:
      mqtt(s)://[username[:password]@]host[:port]/topic
 -N : do not add an end of line character when printing the payload.
 -p : network port to connect to. Defaults to 1883 for plain MQTT and 8883 for MQTT over TLS.
 -P : provide a password
 -q : quality of service level to use for the subscription. Defaults to 0.
 -R : do not print stale messages (those with retain set).
 -t : mqtt topic to subscribe to. May be repeated multiple times.
 -T : topic string to filter out of results. May be repeated.
 -u : provide a username
 -U : unsubscribe from a topic. May be repeated.
 -v : print published messages verbosely.
 -V : specify the version of the MQTT protocol to use when connecting.
      Can be mqttv5, mqttv311 or mqttv31. Defaults to mqttv311.
 -W : Specifies a timeout in seconds how long to process incoming MQTT messages.
 --help : display this message.
 --quiet : don't print error messages.
 --retained-only : only handle messages with the retained flag set, and exit when the
                   first non-retained message is received.
 --remove-retained : send a message to the server to clear any received retained messages
                     Use -T to filter out messages you do not want to be cleared.
 --will-payload : payload for the client Will, which is sent by the broker in case of
                  unexpected disconnection. If not given and will-topic is set, a zero
                  length message will be sent.
 --will-qos : QoS level for the client Will.
 --will-retain : if given, make the client Will retained.
 --will-topic : the topic on which to publish the client Will.
 --cafile : path to a file containing trusted CA certificates to enable encrypted
            certificate based communication.
 --capath : path to a directory containing trusted CA certificates to enable encrypted
            communication.
 --cert : client certificate for authentication, if required by server.
 --key : client private key for authentication, if required by server.
 --keyform : keyfile type, can be either "pem" or "engine".
 --ciphers : openssl compatible list of TLS ciphers to support.
 --tls-version : TLS protocol version, can be one of tlsv1.3 tlsv1.2 or tlsv1.1.
                 Defaults to tlsv1.2 if available.
 --insecure : do not check that the server certificate hostname matches the remote
              hostname. Using this option means that you cannot be sure that the
              remote host is the server you wish to connect to and so is insecure.
              Do not use this option in a production environment.
 --tls-engine : If set, enables the use of a SSL engine device.
 --tls-engine-kpass-sha1 : SHA1 of the key password to be used with the selected SSL engine.
 --psk : pre-shared-key in hexadecimal (no leading 0x) to enable TLS-PSK mode.
 --psk-identity : client identity string for TLS-PSK mode.
 --proxy : SOCKS5 proxy URL of the form:
           socks5h://[username[:password]@]hostname[:port]
           Only "none" and "username" authentication is supported.

See https://mosquitto.org/ for more information.
User avatar
FireWizard
Posts: 1862
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: help with panasonic cloud

Post by FireWizard »

Hi,

@Gianni

I assume that your MQTT server is running on the same device as your pcomfortcloud.py script.

Can you try this:

Code: Select all

python3 pcomfortcloud.py login pasword get 1 | /mosquitto_pub --url mqtt://127.0.0.1/panasonic/living -s
Regards
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: help with panasonic cloud

Post by Gianni »

Hi FireWizard

Everything is running on the same server indeed
I did some testing.
i have to remove the / before mosquitto_pub because is got a error that this is not a folder.
So after that i run the command on terminal 1 en run the second command on terminal 2
No output.
Then is start the command on Term 2 first en run the pub as second and then i get the stats of device 1

grts Gianni
User avatar
FireWizard
Posts: 1862
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: help with panasonic cloud

Post by FireWizard »

Hi @Gianni,

My apologies for the copy and paste error.

The first publication I sent you, I tested in some way with another (simple) MQTT server (hbmqtt) and I wrongly assumed that the syntax was identical with the required syntax for Mosquitto. It was almost, but not fully.

So I only used --url (or -L) for the IP address for the MQTT server and a separate -t for the topic.
And obviously that was not allowed and I had to combine these.

I took the freedom the choose as topic panasonic/living.

You can choose your own topic name, as I think you have another device as well.
So select your desired topic names.

The other forward / was a left over from the full path, I suggested.
So after that i run the command on terminal 1 en run the second command on terminal 2
No output.
Then is start the command on Term 2 first en run the pub as second and then i get the stats of device 1
I should have told you to start the mosquitto_sub first and then mosquitto_pub.

Are you satisfied with the result? Does it match with the published message?

We are now so far that you have to make some decisions.

This command:
python3 pcomfortcloud.py login pasword get 1 | mosquitto_pub --url mqtt://127.0.0.1/panasonic/living -s
you can run in cronjob. But as Cron has its own environment and so is unaware of the environment variables you have to use the full path for python3, pcomfortcloud.py and mosquitto_pub
You have also to decide how often you want to run this command.
And of course your second device.

Another option is to create a bash file, with includes the commands, including the polling time.
This bash file can run as a service, so that it directly start after a reboot.

It is up to you.

The next step is to connect Node Red to the Mosquitto server and to convert the published message, so that Domoticz will accept it.

If you are not familiar with NR I can create that flow(s) for you.
In that case you have to tell me:
- what are the names for the topics, you have chosen?
- which sensors do you want to see in Domoticz?
From time to time you have to test things and to return some screenshots.

Let me know.

Regards
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: help with panasonic cloud

Post by Gianni »

hello

much appreciated the help and time.
Mosquitto and NR is complete new for me.

I prefer bash because is used this a few years ago.
Maybe show me for 1 device and 1 topic and i will try to create it for the second device in the bedroom and other topics.

So what i thought(i dont know if this is possible with NR)
I want to use it like i use it on my app.
read/Set the temp(inside,outside an asked temp)
read/Set the modus(auto warm cool etc)
read/set the airoswing.
read/set the fan

After that is will try to connect it with my temp sensor from my smoke detector and Motion control to control it.
If the temp is below 20° set modus heat and temp 23° for example.

grts Gianni
User avatar
FireWizard
Posts: 1862
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: help with panasonic cloud

Post by FireWizard »

Hi,
@Gianni,
Mosquitto and NR is complete new for me.
You don't have to worry about Mosquitto. This server is just running in the background.
And we know already that it is running
Node Red is just fun and it is an excellent companion with Domoticz

If you have some time try to read a few things about it

For the moment we focus on the sensors, so the data from the script to Domoticz.
Later we will do the commands to activate the script.

I see in the output of the script the following sensors:

- temperatureInside > That will be a temperature sensor
- temperatureOutside > temperature sensor, as well
- temperature > Is this a setpoint?
- power> I assume On or Off
- mode > Which are all supported modes?
- fanspeed > Which are the supported modes for fanspeed?
- airSwingHorizontal > Same question
- airSwingVertical > Same question
- eco > Same question

[Edit] I think, I have found all possibilities at: https://community.openhab.org/t/panason ... n/65085/13. Can you check, if it is correct.?

How many times do you want to make a request ( 1 per minute? More? Less?)
This means 9 sensors in total.

Regards
Gianni
Posts: 230
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Home@Belgium
Contact:

Re: help with panasonic cloud

Post by Gianni »

hello

thats the correct setting from openhab.
Only the horizontal swing is not auto.
For the request maybe every 10 min?
If i have a working example i will try to modifty it for the other devices and setting?
So it will be posible to use a flow with other zwave devices like if the temp outside is 24 and inside of the motion control temp is 25 i need to cool down to 20.
Or if its 5° outside and inside 18 need to set mode heat and heat up to 22°?

grts Gianni
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest