Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any version for Jeedom like ha-emporia-vue ? #34

Open
tazelbaze opened this issue Nov 27, 2021 · 3 comments
Open

Any version for Jeedom like ha-emporia-vue ? #34

tazelbaze opened this issue Nov 27, 2021 · 3 comments

Comments

@tazelbaze
Copy link

Such a good script for Emporia.
Any chance to have it for Jeedom ?

@magico13
Copy link
Owner

Home Assistant is the only one I have plans to officially support myself since that's the one I use personally. However if someone decides to create something for another home automation provider I'd be happy to provide guidance and accept pull requests if they need changes in the library.

@tazelbaze
Copy link
Author

hummm... thanks for that.
i'm too short in programming but i've seen that Jeedom is able to embed py script. Maybe it was possible...
For this time i've deployer an HA instance, with MQTT and node-red and send data to Jeedom :-(
A crazy thing !

@tazelbaze
Copy link
Author

tazelbaze commented Nov 28, 2021

this file works, but I get stuck on generating a json file that is easier to use.
I blend in the indentations ... I generate a flat file, but I struggle with a json
Any help ?

`
from pyemvue import PyEmVue

def print_recursive(usage_dict, info, depth=0):
for gid, device in usage_dict.items():
for channelnum, channel in device.channels.items():
name = channel.name
if name == 'Main':
name = info[gid].device_name
print('-'*depth, f'{gid} {channelnum} {name} {channel.usage} kwh')
fichier.write(f'{gid} {channelnum} {name} {channel.usage} kwh\n')
if channel.nested_devices:
print_recursive(channel.nested_devices, depth+1)

vue = PyEmVue()
vue.login(username=[email protected]', password='xxxxx', token_storage_file='keys.json')

devices = vue.get_devices()
device_gids = []
info = {}
fichier = open("PyEmVue.log", "w+")

for device in devices:
if not device.device_gid in device_gids:
device_gids.append(device.device_gid)
info[device.device_gid] = device
else:
info[device.device_gid].channels += device.channels

device_usage_dict = vue.get_device_list_usage(deviceGids=device_gids, instant=None, scale="1MIN", unit="KilowattHours")
print_recursive(device_usage_dict, info)
fichier.write("\n*** C'est fini ***")
fichier.close()
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants